package com.snail.service.impl;


import com.snail.dao.ProductCategoryDao;
import com.snail.entity.ProductCategory;
import com.snail.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 【swg】.
 * @Date 2017/12/8 9:20
 * @DESC
 * @CONTACT 317758022@qq.com
 */
@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private ProductCategoryDao productCategoryDao;

    @Override
    public ProductCategory getByCategoryId(Integer categoryId) {
        return productCategoryDao.findOne(categoryId);
    }

    @Override
    public List<ProductCategory> productCategoryListByType(List<Integer> categoryTypeList) {
        return productCategoryDao.findByCategoryTypeIn(categoryTypeList);
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return productCategoryDao.save(productCategory);
    }

    @Override
    public List<ProductCategory> getAll() {
        return productCategoryDao.findAll();
    }
}
